/*
 *  Licensed to PECATS under one or more contributor license agreements below:
 *  1. http://www.mozilla.org/MPL/MPL-1.1.html
 *  2. http://www.gnu.org/licenses/gpl-2.0.html
 *  3. http://www.gnu.org/licenses/lgpl-2.1.html
*/

/* **********************************************************
*  Class to handle reading of log files, printing results
*  Name: Handler.java
*  Author: www.pecats.com
*  Date: Sep 15, 2008
************************************************************/

package com.pecats.batch.core;

import java.io.File;
import java.io.IOException;
import com.pecats.batch.data.ConfigData;
import com.pecats.batch.util.ParseXMLFile;
import com.pecats.batch.main.openXplore;
import com.pecats.batch.util.MoveFile;

/**
 * Used to create seperate threads to read log files and print results
 */

public class Handler implements Runnable 
{

	private final File file;
	private final File dir;

	Handler(File file, File dir) 
	{
	    this.file = file;
	    this.dir = dir;
	}

	public void run() 
	{
		try
		{
			new ReadFile(file,dir);
			MoveFile.move(file, new File(ConfigData.processedlogsdir + openXplore.PATHSEPERATOR + dir.getName() + openXplore.PATHSEPERATOR  +file.getName()));
			file.delete();
		}
		catch (IOException io)
		{
		}

   	}
 }